def is_tangle_num(num):
    num *= 2
    t1 = int(pow(num, 0.5))
    t2 = t1 + 1
    return t1 * t2 == num


if __name__ == '__main__':
    res = 0
    with open('./p042_words.txt', "r") as f:
        words = f.read().split(',')
    for word in words:
        t = 0
        word = word.replace('"', '')
        for i in word:
            t += (ord(i) - ord('A') + 1)
        if is_tangle_num(t):
            res += 1
    print(res)
